package com.lagou.edu.service.impl;

import com.lagou.edu.dao.ResumeDao;
import com.lagou.edu.pojo.Resume;
import com.lagou.edu.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 赵虎
 * 2020/10/24 2:05 上午
 */
@Service
public class ResumeServiceImpl implements ResumeService {

    @Autowired
    private ResumeDao resumeDao;


    @Override
    public List<Resume> findList() {
        return resumeDao.findAll();
    }

    @Override
    public Resume findById(Long id) {
        return resumeDao.findById(id).get();
    }

    @Override
    public Boolean save(Resume resume) {
        resumeDao.save(resume);
        return true;
    }

    @Override
    public Boolean update(Resume resume) {
        boolean exists = resumeDao.existsById(resume.getId());
        if (!exists) {
            System.out.println("不存在");
        }
        resumeDao.save(resume);
        return true;
    }

    @Override
    public Boolean delete(Long id) {
        resumeDao.deleteById(id);
        return true;
    }
}
